Subscribe Form Sample

Your subscription request
has been sent!


Description

The HTML structure inside the form is flexible, the only condition is that inputs should be placed inside the label tags that have class corresponding to their type.

There are following classes/types by default:

  • name – the User's Name. Validation: digits are disallowed, not less than 2 symbols;
  • email – the User's Email;
The Code:

<label class="name">
  <input type="text" value="Enter Name:">
</label>
<label class="email">
  <input type="email" value="Enter Email:">
</label>

Also label tag mentioned above can contain nested span elements with class error, which include the error message in case the data in the field is specified incorrectly.

The Code:

<label class="name">
  <input type="text" value="Enter Name:">
  <span class="error">*This is not a valid name.</span> </label>
<label class="email">
  <input type="email" value="Enter Email:">
  <span class="error">*This is not a valid email address.</span>

Script Initialization

To activate the subscribe form you need to include subscribe form script in the <head> section of HTML file and copy "bat" folder to your website root folder. The "bat" folder should contain 1 file: MailHandler-sub.php

<script type="text/javascript" src="js/jquery.min.js(jquery-1.8.2)"></script>
<script type="text/javascript" src="js/sForm.js"></script>

After this you should initialize your subscription form on the $(window).load() : event at the end of sForm.js file


   $(window).load(function(){
    $('#form1').sForm({
      ownerEmail:'#',
      sitename:'sitename.link'
    })
  })

Use the following parameters for initialization:

  • ownerEmail – the Email address the data will be sent to;
  • sitename – website address which maintains subscription form.

In case of successful subscription website owner and website visitor get two separate successful subscription confirmation emails. Website owner target email is grabbed from sForm.js file and website visitor email is an email specified during subscription.